package com.atguigu.srb.core.controller.api;


import com.atguigu.common.results.R;
import com.atguigu.srb.core.pojo.entity.Dict;
import com.atguigu.srb.core.service.DictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2022-10-24
 */
@RestController
@RequestMapping("/api/core/dict")
public class ApiDictController {
    @Autowired
    DictService dictService;
    @ApiOperation("根据dictCode查询二级数据字典")
    @GetMapping("queryDictsByDictCode/{dictCode}")
    public R queryDictsByDictCode(@PathVariable("dictCode")String dictCode){
        List<Dict> dicts =  dictService.queryDictsByDictCode(dictCode);
        return R.success().data("items",dicts);
    }

}

